#!/bin/bash

#------------------------------------------------------------------------------
#Filename:	74771-installkernel.sh
#Version:	1.1
#Date:		2013/07/15
#Author:	yuanhui.shi
#Email:		yuanhui.shi@cs2c.com.cn
#Summary:	02.01系统核心功能-05内核支持-01内核-03安装内核
#Notes:		单独安装内核，查看grub.conf文件是否正确。需要搭载yum源或者提前准备好iso镜像，本脚本需要手动插入光盘。
#Copyright:	China Standard Software Co.,Ltd.
#History:
#		Version 1.0,2013/07/11
#		-The first one
#		Version 1.1,2013/09/03
#		-Modify the script to satisfy the shell standard
#------------------------------------------------------------------------------


PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh

function CleanData()
{
  umount /mnt
  EchoInfo "74771-installkernel.sh执行完毕"
  eject
}

trap "CleanData" EXIT

EchoInfo "请手动插入该系统iso所在的光盘！"
mount /dev/cdrom /mnt
rpm -ivh /mnt/Packages/kernel-2.6.32-358.el6.x86_64.rpm &> /dev/null
test -n `ls /boot |grep vmlinuz` -a -n `ls /boot |grep initramfs` 
EchoResult "安装内核后，boot目录内kernel以及ramdisk文件已生成"

test -n "`cat /boot/grub/menu.lst |grep "NeoKylin Linux Advanced Server"`" 
EchoResult "内核安装成功"
